//
//  LXTYQHomeVC.swift
//  LuoXuanTYQ
//
//  Created by 李东 on 2024/3/16.
//

import UIKit

class LXTYQHomeVC: LXTYQBaseVC {
    
    
    @IBOutlet weak var setupBtn_top: NSLayoutConstraint!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        hideNavgaitionBar()
        setupBtn_top.constant = CGFloat.topPadding
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        if AppProducts.shared.isPurchased {
            adHelper.removeBannerView()
        }else{
            if hasLoadAd {
                return
            }
            hasLoadAd = true
            adHelper.loadBanner(currentVC: self, isMainVC: false)
        }
    }

    
    @IBAction func settingHandle(_ sender: Any) {
        navigationController?.pushViewController(LXTYQMineVC(), animated: true)
    }
    
    

    @IBAction func itemBtnHandle(_ sender: UIButton) {
        if !AppProducts.shared.isPurchased {
            showSubVC()
            return
        }
        let tagIndex = sender.tag
        switch tagIndex {
        case 100:
            RXPermissionUtils.microphone {[weak self] in
                guard let self = self else { return }
                self.navigationController?.pushViewController(LXTYQWebVC(url: AppConfig.H5_URL), animated: true)
            }
            break
        case 101:
            navigationController?.pushViewController(LXTYQCalendarVC(), animated: true)
            break
        default:
            break
        }
    }
    
  

}
